// CNode.cpp: implementation of the CNode class.
//
//////////////////////////////////////////////////////////////////////

#include "CNode.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CNode::CNode()
{
	closed=false;
}

CNode::CNode(SOCKET csocket){
	this->csocket = csocket;
	closed=false;
	this->in.setSocket(this->csocket);
	this->out.setSocket(this->csocket);
}

CNode::~CNode()
{

}

bool CNode::isConnected() {
//	int rc =  recv(csocket,NULL,0,0);
    if ((csocket != INVALID_SOCKET)&&(!closed)) { 
         return true;
      } else { 
      return false;
    }
   return false;
/*	if(rc == 0){
		return true;
	} else {
		return false;
	}*/
}

void CNode::close(){
	///* Cierro la conexion */
	//shutdown(csocket);
	closesocket(csocket);
	closed=true;
}
